﻿{include file="/public/header" /}
<div class="content-wraper full">
    <div class="tabs-link-wrap" level="first">
        <div class="tabs-link-scroll">
            <!--{if ($nav ?? NULL)}-->
            <!--{foreach $nav as $key => $row}-->
            <a href="{$_G['_mca_'] ?? ''}/nkey/{$key ?? ''}" {if $nkey==$key}class="active"{/if}>{$row['title'] ?? ''}</a>
            <!--{/foreach}-->
            <!--{/if}-->
        </div>
    </div>
    <!--{if ($nkey ?? '')=='index'}-->
    <div class="tools-bar">
        <a data-key="comp"><i class="fa fa-eraser"></i> 销售免支付</a>
    </div>
    <div class="normal-line"></div>
    <!--{/if}-->
    <div class="search_wraper" style="min-height: 51px;">
        <form class="normal_form search_form" onsubmit="return false;">
            <div class="condition" onscroll="Core.scrolling(this)">
                <div class="row inline-row" row-name="mydatetime">
                </div>               
            </div>
            <div class="row form-footer-bar">
                <button class="btn" type="reset" role="btn-cancel">重置</button>
                <button r-button class="btn btn-primary search-btn" type="submit" role="btn-submit">搜索</button>
                <button r-button style="display: none;" class="btn switch_search filter">展开搜索条件<i class="fa fa-angle-down"></i></button>
                <button r-button style="display: none;" class="tools-bar">
                    <div class="field_text">本页金额：<span data-key="pamount">0</span></div>
                    <div class="field_text">总计金额：<span data-key="amount">0</span></div>
                </button>
                <div style="margin: 10px 0 -10px;"><a class="search_close"><i class="fa fa-angle-up"></i>收起</a></div>
            </div>            
        </form>
    </div>
    <div class="table_box">
        <table class="table_main" id="datalist"></table>
    </div>
</div>
<script type="text/javascript">
Core.Easyui.FieldColumn = [
    {field:'teamname',title:'销售组别',width:120,align:'center'},
    {field:'grade',title:'服务钟费(元)',width:100,align:'center'},
    {field:'juice',title:'特饮费(元)/小时',width:110,align:'center'},
    {field:'trial',title:'免费时长(分钟)',width:100,align:'center'},
    {field:'duration',title:'服务时长(分钟)',width:100,align:'center'},
    {field:'amount',title:'特饮费(元)',width:100,align:'center'},
    {field:'kday',title:'订单日期',width:100,align:'center'},
    {field:'stime',title:'进入包厢时间',width:130,align:'center'},
    {field:'etime',title:'离开包厢时间',width:130,align:'center'},
    {field:'sysmsg',title:'系统信息',width:320,align:'left'},
    {field:'-',title:'',align:'left'},
];
Core.Easyui.FrozenColumn = [
    {field:'ck',checkbox:true,width:30},
    {field:'id',title:'ID',width:80,align:'center'},
    {field:'kid',title:'订单ID',width:100,align:'center'},
    {field:'logename',title:'包厢',width:100,align:'center'},
    {field:'nickname',title:'销售',width:180,align:'center',search: true, nowsearch: true, searchtype: 'input'},
];
Core.Easyui.init($("#datalist"), {
    url: "{$_G['_mc_'] ?? ''}/ajax/nkey/{$nkey ?? ''}",
    idField: "id",
    fitColumns: false,
    singleSelect : true,
    columns: [Core.Easyui.FieldColumn],
    frozenColumns: [Core.Easyui.FrozenColumn],
    pageSize: 50,
    onLoadSuccess:function(data){
        $('span[data-key="pamount"]').text((data.pamount || 0)+' 元');
        $('span[data-key="amount"]').text((data.amount || 0)+' 元');
    },
    onDblClickRow: function (index,row){
        Core.Sys.Action('pop',row);
    },
},$(".search_form"));

Core.Sys.Action = function(Tkey,row){
    switch(Tkey){
        case 'comp':
            var row = $('#datalist').datagrid('getSelected');
            if (row.payment != 0) {Core.Dialog.msg('该特饮费已处理，无需支付');return;}
            Core.Dialog.open({'title': '免单，ID:'+row.id+',包厢:'+row.logename,'width': '500px','height': '320px','url': "{$_G['_mc_'] ?? ''}/comp/nkey/{$nkey ?? 'index'}/id/"+row.id});
        break;
    }
    return;
}
/**搜索 */
var Table_Filters = Core.Search.searchArray();
var filterType = Core.Search.typeList();
//var rsourceUrl = "/index/ajax/index"; //搜索字段基础数据
//var regionUrl = "/index/ajax/district/level/"; //城市搜索字段
Core.Search.initFilter("{$_G['_mc_'] ?? ''}/column",null);

$(document).ready(function(){
    $('.tools-bar').find('a[data-key]').on('click',function(){
        var Tkey = $(this).attr('data-key');
        if (!Core.rule('key',Tkey)) return false;
        Core.Sys.Action(Tkey);
    });
});
</script>
{include file="/public/footer" /}